<template>
  <ConfigProvider :locale="getAntdLocale" :theme="themeConfig">
    <AppProvider>
      <RouterView />

      <FloatButton tooltip="1500197853" type="primary" @click="Click"
        ><template #icon>
          <WechatOutlined />
        </template>
        <a-float-button />
      </FloatButton>
    </AppProvider>
  </ConfigProvider>
</template>

<script lang="ts" setup>
  import { FloatButton, ConfigProvider } from 'ant-design-vue';
  import { WechatOutlined } from '@ant-design/icons-vue';
  import { AppProvider } from '@/components/Application';
  import { useTitle } from '@/hooks/web/useTitle';
  import { useLocale } from '@/locales/useLocale';

  import { useDarkModeTheme } from '@/hooks/setting/useDarkModeTheme';
  import 'dayjs/locale/zh-cn';
  import { computed } from 'vue';

  // support Multi-language
  const { getAntdLocale } = useLocale();

  const { isDark, darkTheme } = useDarkModeTheme();
  function Click(item) {
    console.log(123, item);
  }
  const themeConfig = computed(() =>
    Object.assign(
      {
        token: {
          colorPrimary: '#0960bd',
          colorSuccess: '#55D187',
          colorWarning: '#EFBD47',
          colorError: '#ED6F6F',
          colorInfo: '#0960bd',
        },
      },
      isDark.value ? darkTheme : {},
    ),
  );
  // Listening to page changes and dynamically changing site titles
  useTitle();
</script>
